package com.itheima.demo03;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo {

    public static void main(String[] args) throws ParseException {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat();

        //public final String format(Date date)
        String format = simpleDateFormat.format(new Date());   //2019/8/27 下午7:35
        System.out.println(format);

        //public String toPattern()
        String s = simpleDateFormat.toPattern();               //y/M/d ah:mm
        System.out.println(s);

        System.out.println("-----------------------------------------------");

        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String format1 = simpleDateFormat1.format(new Date());          // 2019-08-27 19:50:08
        System.out.println(format1);

    }
}
